#define _CRT_SECURE_NO_WARNINGS 1
#include"Seplist.h"

void SLInit(SL* psl)
{
	psl->a = (SLdatetype*)malloc(sizeof(SLdatetype) * 4);
	if (psl->a == NULL)
	{
		perror("malloc file");
		return;
	}
	psl->capacity = 4;
	psl->size = 0;
}
void SLChackSeplist(SL* psl)
{
	if (psl->size == psl->capacity)
	{
		SLdatetype* tmp = (SLdatetype*)realloc(psl->a, sizeof(SLdatetype) * psl->capacity * 2);
		if (tmp == NULL)
		{
			perror("realloc");
			return;
		}
		psl->a = tmp;
		psl->capacity *= 2;
	}
}
void SLPushBack(SL* psl,SLdatetype x)
{
	SLChackSeplist(psl);
	psl->a[psl->size] = x;
}

void SLDestroy(SL* psl)
{
	free(psl->a);
	psl->a = NULL;
	psl->capacity = 0;
	psl->size = 0;
}